<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">
<link href="style.css" type="text/css" rel="stylesheet">
<title>PSHUFLW—Shuffle Packed Low Words </title></head>
<body>
<h1>PSHUFLW—Shuffle Packed Low Words</h1>
<table>
<tr>
<th>Opcode/Instruction</th>
<th>Op/En</th>
<th>64/32 bit Mode Support</th>
<th>CPUID Feature Flag</th>
<th>Description</th></tr>
<tr>
<td>
<p>F2 0F 70 /<em>r</em> ib</p>
<p>PSHUFLW <em>xmm1</em>, <em>xmm2/m128</em>, <em>imm8</em></p></td>
<td>RMI</td>
<td>V/V</td>
<td>SSE2</td>
<td>Shuffle the low words in <em>xmm2/m128</em> based on the encoding in <em>imm8</em> and store the result in <em>xmm1</em>.</td></tr>
<tr>
<td>
<p>VEX.128.F2.0F.WIG 70 /r ib</p>
<p>VPSHUFLW <em>xmm1, xmm2/m128, imm8</em></p></td>
<td>RMI</td>
<td>V/V</td>
<td>AVX</td>
<td>Shuffle the low words in <em>xmm2/m128</em> based on the encoding in <em>imm8</em> and store the result in <em>xmm1</em>.</td></tr>
<tr>
<td>
<p>VEX.256.F2.0F.WIG 70 /r ib</p>
<p>VPSHUFLW <em>ymm1, ymm2/m256, imm8</em></p></td>
<td>RMI</td>
<td>V/V</td>
<td>AVX2</td>
<td>Shuffle the low words in <em>ymm2/m256</em> based on the encoding in <em>imm8</em> and store the result in <em>ymm1</em>.</td></tr>
<tr>
<td>
<p>EVEX.128.F2.0F.WIG 70 /r ib</p>
<p>VPSHUFLW xmm1 {k1}{z}, xmm2/m128, imm8</p></td>
<td>FVM</td>
<td>V/V</td>
<td>AVX512VL AVX512BW</td>
<td>Shuffle the low words in xmm2/m128 based on the encoding in imm8 and store the result in xmm1 under write mask k1.</td></tr>
<tr>
<td>
<p>EVEX.256.F2.0F.WIG 70 /r ib</p>
<p>VPSHUFLW ymm1 {k1}{z}, ymm2/m256, imm8</p></td>
<td>FVM</td>
<td>V/V</td>
<td>AVX512VL AVX512BW</td>
<td>Shuffle the low words in ymm2/m256 based on the encoding in imm8 and store the result in ymm1 under write mask k1.</td></tr>
<tr>
<td>
<p>EVEX.512.F2.0F.WIG 70 /r ib</p>
<p>VPSHUFLW zmm1 {k1}{z}, zmm2/m512, imm8</p></td>
<td>FVM</td>
<td>V/V</td>
<td>AVX512BW</td>
<td>Shuffle the low words in zmm2/m512 based on the encoding in imm8 and store the result in zmm1 under write mask k1.</td></tr></table>
<h3>Instruction Operand Encoding</h3>
<table>
<tr>
<td>Op/En</td>
<td>Operand 1</td>
<td>Operand 2</td>
<td>Operand 3</td>
<td>Operand 4</td></tr>
<tr>
<td>RMI</td>
<td>ModRM:reg (w)</td>
<td>ModRM:r/m (r)</td>
<td>imm8</td>
<td>NA</td></tr>
<tr>
<td>FVM</td>
<td>ModRM:reg (w)</td>
<td>ModRM:r/m (r)</td>
<td>Imm8</td>
<td>NA</td></tr></table>
<h2>Description</h2>
<p>Copies words from the low quadword of a 128-bit lane of the source operand and inserts them in the low quadword of the destination operand at word locations (of the respective lane) selected with the immediate operand. The 256-bit operation is similar to the in-lane operation used by the 256-bit VPSHUFD instruction, which is illustrated in Figure 4-16. For 128-bit operation, only the low 128-bit lane is operative. Each 2-bit field in the immediate operand selects the contents of one word location in the low quadword of the destination operand. The binary encodings of the immediate operand fields select words (0, 1, 2 or 3) from the low quadword of the source operand to be copied to the destination operand. The high quadword of the source operand is copied to the high quadword of the destination operand, for each 128-bit lane.</p>
<p>Note that this instruction permits a word in the low quadword of the source operand to be copied to more than one word location in the low quadword of the destination operand.</p>
<p>In 64-bit mode and not encoded with VEX/EVEX, using a REX prefix in the form of REX.R permits this instruction to access additional registers (XMM8-XMM15).</p>
<p>128-bit Legacy SSE version: The destination operand is an XMM register. The source operand can be an XMM register or a 128-bit memory location. Bits (VLMAX-1:128) of the corresponding YMM destination register remain unchanged.</p>
<p>VEX.128 encoded version: The destination operand is an XMM register. The source operand can be an XMM register or a 128-bit memory location. Bits (VLMAX-1:128) of the destination YMM register are zeroed.</p>
<p>VEX.256 encoded version: The destination operand is an YMM register. The source operand can be an YMM register or a 256-bit memory location.</p>
<p>EVEX encoded version: The destination operand is a ZMM/YMM/XMM registers. The source operand can be a ZMM/YMM/XMM register, a 512/256/128-bit memory location. The destination is updated according to the writemask.</p>
<p>Note: In VEX encoded versions, VEX.vvvv is reserved and must be 1111b otherwise instructions will #UD.</p>
<h2>Operation</h2>
<p><strong>PSHUFLW (128-bit Legacy SSE version)</strong></p>
<pre>DEST[15:0] (cid:197) (SRC &gt;&gt; (imm[1:0] *16))[15:0]
DEST[31:16] (cid:197) (SRC &gt;&gt; (imm[3:2] * 16))[15:0]
DEST[47:32] (cid:197) (SRC &gt;&gt; (imm[5:4] * 16))[15:0]
DEST[63:48] (cid:197) (SRC &gt;&gt; (imm[7:6] * 16))[15:0]
DEST[127:64] (cid:197) SRC[127:64]
DEST[VLMAX-1:128] (Unmodified)</pre>
<p><strong>VPSHUFLW (VEX.128 encoded version)</strong></p>
<pre>DEST[15:0] (cid:197) (SRC1 &gt;&gt; (imm[1:0] *16))[15:0]
DEST[31:16] (cid:197) (SRC1 &gt;&gt; (imm[3:2] * 16))[15:0]
DEST[47:32] (cid:197) (SRC1 &gt;&gt; (imm[5:4] * 16))[15:0]
DEST[63:48] (cid:197) (SRC1 &gt;&gt; (imm[7:6] * 16))[15:0]
DEST[127:64] (cid:197) SRC[127:64]
DEST[VLMAX-1:128] (cid:197) 0</pre>
<p><strong>VPSHUFLW (VEX.256 encoded version)</strong></p>
<pre>DEST[15:0] (cid:197) (SRC1 &gt;&gt; (imm[1:0] *16))[15:0]
DEST[31:16] (cid:197) (SRC1 &gt;&gt; (imm[3:2] * 16))[15:0]
DEST[47:32] (cid:197) (SRC1 &gt;&gt; (imm[5:4] * 16))[15:0]
DEST[63:48] (cid:197) (SRC1 &gt;&gt; (imm[7:6] * 16))[15:0]
DEST[127:64] (cid:197) SRC1[127:64]
DEST[143:128] (cid:197) (SRC1 &gt;&gt; (imm[1:0] *16))[143:128]
DEST[159:144] (cid:197) (SRC1 &gt;&gt; (imm[3:2] * 16))[143:128]
DEST[175:160] (cid:197) (SRC1 &gt;&gt; (imm[5:4] * 16))[143:128]
DEST[191:176] (cid:197) (SRC1 &gt;&gt; (imm[7:6] * 16))[143:128]
DEST[255:192] (cid:197) SRC1[255:192]
DEST[VLMAX-1:256] (cid:197) 0</pre>
<p><strong>VPSHUFLW (EVEX.U1.512 encoded version)</strong></p>
<pre>(KL, VL) = (8, 128), (16, 256), (32, 512)
IF VL &gt;= 128
    TMP_DEST[15:0] (cid:197) (SRC1 &gt;&gt; (imm[1:0] *16))[15:0]
    TMP_DEST[31:16] (cid:197) (SRC1 &gt;&gt; (imm[3:2] * 16))[15:0]
    TMP_DEST[47:32] (cid:197) (SRC1 &gt;&gt; (imm[5:4] * 16))[15:0]
    TMP_DEST[63:48] (cid:197) (SRC1 &gt;&gt; (imm[7:6] * 16))[15:0]
    TMP_DEST[127:64] (cid:197) SRC1[127:64]
FI;
IF VL &gt;= 256
    TMP_DEST[143:128] (cid:197) (SRC1 &gt;&gt; (imm[1:0] *16))[143:128]
    TMP_DEST[159:144] (cid:197) (SRC1 &gt;&gt; (imm[3:2] * 16))[143:128]
    TMP_DEST[175:160] (cid:197) (SRC1 &gt;&gt; (imm[5:4] * 16))[143:128]
    TMP_DEST[191:176] (cid:197) (SRC1 &gt;&gt; (imm[7:6] * 16))[143:128]
    TMP_DEST[255:192] (cid:197) SRC1[255:192]
FI;
IF VL &gt;= 512
    TMP_DEST[271:256] (cid:197) (SRC1 &gt;&gt; (imm[1:0] *16))[271:256]
    TMP_DEST[287:272] (cid:197) (SRC1 &gt;&gt; (imm[3:2] * 16))[271:256]
    TMP_DEST[303:288] (cid:197) (SRC1 &gt;&gt; (imm[5:4] * 16))[271:256]
    TMP_DEST[319:304] (cid:197) (SRC1 &gt;&gt; (imm[7:6] * 16))[271:256]
    TMP_DEST[383:320] (cid:197) SRC1[383:320]
    TMP_DEST[399:384] (cid:197) (SRC1 &gt;&gt; (imm[1:0] *16))[399:384]
    TMP_DEST[415:400] (cid:197) (SRC1 &gt;&gt; (imm[3:2] * 16))[399:384]
    TMP_DEST[431:416] (cid:197) (SRC1 &gt;&gt; (imm[5:4] * 16))[399:384]
    TMP_DEST[447:432] (cid:197) (SRC1 &gt;&gt; (imm[7:6] * 16))[399:384]
    TMP_DEST[511:448] (cid:197) SRC1[511:448]
FI;
FOR j (cid:197) 0 TO KL-1
    i (cid:197) j * 16
    IF k1[j] OR *no writemask*
         THEN DEST[i+15:i] (cid:197) TMP_DEST[i+15:i];
         ELSE
              IF *merging-masking*
                                                         ; merging-masking
                    THEN *DEST[i+15:i] remains unchanged*
                    ELSE *zeroing-masking*
                                                               ; zeroing-masking
                         DEST[i+15:i] (cid:197) 0
              FI
    FI;
ENDFOR
DEST[MAX_VL-1:VL] (cid:197) 0</pre>
<h2>Intel C/C++ Compiler Intrinsic Equivalent</h2>
<p>VPSHUFLW __m512i _mm512_shufflelo_epi16(__m512i a, int n);</p>
<p>VPSHUFLW __m512i _mm512_mask_shufflelo_epi16(__m512i s, __mmask16 k, __m512i a, int n );</p>
<p>VPSHUFLW __m512i _mm512_maskz_shufflelo_epi16( __mmask16 k, __m512i a, int n );</p>
<p>VPSHUFLW __m256i _mm256_mask_shufflelo_epi16(__m256i s, __mmask8 k, __m256i a, int n );</p>
<p>VPSHUFLW __m256i _mm256_maskz_shufflelo_epi16( __mmask8 k, __m256i a, int n );</p>
<p>VPSHUFLW __m128i _mm_mask_shufflelo_epi16(__m128i s, __mmask8 k, __m128i a, int n );</p>
<p>VPSHUFLW __m128i _mm_maskz_shufflelo_epi16( __mmask8 k, __m128i a, int n );</p>
<p>(V)PSHUFLW:__m128i _mm_shufflelo_epi16(__m128i a, int n)</p>
<p>VPSHUFLW:__m256i _mm256_shufflelo_epi16(__m256i a, const int n)</p>
<h2>Flags Affected</h2>
<p>None.</p>
<h2>SIMD Floating-Point Exceptions</h2>
<p>None.</p>
<h2>Other Exceptions</h2>
<p>Non-EVEX-encoded instruction, see Exceptions Type 4;</p>
<table class="exception-table">
<tr>
<td>EVEX-encoded instruction, see Exceptions Type E4NF.nb</td></tr>
<tr>
<td>If VEX.vvvv != 1111B, or EVEX.vvvv != 1111B.</td></tr></table></body></html>